/*************************************************************************
 *
 *  Copyright (C) 2013 Florian Dang <florian.coin@gmail.com>
 *
 *  This file is part of NatusVerse.
 *
 *  NatusVerse is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  NatusVerse is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NatusVerse.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************/

#ifndef INC_NBODY_UNIVERSE_H_
#define INC_NBODY_UNIVERSE_H_

/*!
 * \file        universe.h
 * \brief       N-Body problem header file
 * \author      Florian Dang
 * \date        2013
 *
 */

#include <vector>

#include "graphics/graphics.h"
#include "nbody/body.h"

namespace nbody
{
//! Universe class
/*!
  Describe the universe for the nbody problem
*/
class Universe
{
	public:
		typedef graphics::Graphics Graphics;
		typedef struct
		{
			char key[SDLK_LAST];
		} t_keylast;

		//! Default constructor
		Universe() : win_(), num_particles_(0) {}

		//! Alternative constructor
		explicit Universe(Graphics window)
			: win_(window), num_particles_(0) {}

		//! Alternative constructor with number of particles
		Universe(Graphics window, int num_particles)
			: win_(window), num_particles_(num_particles)
		{
			arr_particles_.resize(num_particles);
			for (int i = 0; i < num_particles; i ++)
			{
				arr_particles_[i] = Body(Graphics::kpoint_orig_t, 0.0f, color::white);
			}
		}

		//! Destructor
		~Universe() {}

		//! Initialize the universe
		void Initialization();

		//! Launch the simulation of the universe
		void Simulation(float dt);


	private:
		Graphics win_;                    /*!< graphical window */
		int num_particles_;               /*!< total number of bodies */
		std::vector<Body> arr_particles_; /*!< array of particles */
};
} // end namespace

#endif  // INC_NBODY_UNIVERSE_H_
